/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */

/*
 * SchedulingLayout.java
 *
 * Created on 07/10/2011, 01:48:32
 */
package wf.ui.layouts;

import bc.dsl.PageDSL;
import bc.swing.pfrm.Page;
import bc.swing.pfrm.PageLayout;

/**
 *
 * @author bennyl
 */
public class SchedulingLayout extends javax.swing.JPanel implements PageLayout{
    public static final String CALENDAR_ROLE = "CALENDAR ROLE";
    public static final String SELECTED_SCHEDULING_ROLE = "SELECTED SCHEDULING ROLE";

    /** Creates new form SchedulingLayout */
    public SchedulingLayout() {
        initComponents();
    }

    /** This method is called from within the constructor to
     * initialize the form.
     * WARNING: Do NOT modify this code. The content of this method is
     * always regenerated by the Form Editor.
     */
    @SuppressWarnings("unchecked")
    // <editor-fold defaultstate="collapsed" desc="Generated Code">//GEN-BEGIN:initComponents
    private void initComponents() {
        java.awt.GridBagConstraints gridBagConstraints;

        jSplitPane1 = new javax.swing.JSplitPane();
        calPan = new javax.swing.JPanel();
        jPanel2 = new javax.swing.JPanel();
        schedulingTitle = new wf.ui.cmps.WFToolbar();
        schedulingPan = new javax.swing.JPanel();

        setLayout(new java.awt.BorderLayout());

        jSplitPane1.setDividerLocation(-1);
        jSplitPane1.setOrientation(javax.swing.JSplitPane.VERTICAL_SPLIT);
        jSplitPane1.setResizeWeight(0.7);

        calPan.setPreferredSize(new java.awt.Dimension(398, 1000));

        javax.swing.GroupLayout calPanLayout = new javax.swing.GroupLayout(calPan);
        calPan.setLayout(calPanLayout);
        calPanLayout.setHorizontalGroup(
            calPanLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGap(0, 398, Short.MAX_VALUE)
        );
        calPanLayout.setVerticalGroup(
            calPanLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGap(0, 100, Short.MAX_VALUE)
        );

        jSplitPane1.setTopComponent(calPan);

        jPanel2.setBackground(new java.awt.Color(255, 255, 255));
        jPanel2.setLayout(new java.awt.GridBagLayout());

        schedulingTitle.setCaption("Selected Day Scheduling");
        gridBagConstraints = new java.awt.GridBagConstraints();
        gridBagConstraints.fill = java.awt.GridBagConstraints.HORIZONTAL;
        gridBagConstraints.weightx = 1.0;
        jPanel2.add(schedulingTitle, gridBagConstraints);

        javax.swing.GroupLayout schedulingPanLayout = new javax.swing.GroupLayout(schedulingPan);
        schedulingPan.setLayout(schedulingPanLayout);
        schedulingPanLayout.setHorizontalGroup(
            schedulingPanLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGap(0, 392, Short.MAX_VALUE)
        );
        schedulingPanLayout.setVerticalGroup(
            schedulingPanLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGap(0, 166, Short.MAX_VALUE)
        );

        gridBagConstraints = new java.awt.GridBagConstraints();
        gridBagConstraints.gridx = 0;
        gridBagConstraints.fill = java.awt.GridBagConstraints.BOTH;
        gridBagConstraints.weightx = 1.0;
        gridBagConstraints.weighty = 1.0;
        gridBagConstraints.insets = new java.awt.Insets(0, 3, 3, 3);
        jPanel2.add(schedulingPan, gridBagConstraints);

        jSplitPane1.setRightComponent(jPanel2);

        add(jSplitPane1, java.awt.BorderLayout.CENTER);
    }// </editor-fold>//GEN-END:initComponents
    // Variables declaration - do not modify//GEN-BEGIN:variables
    private javax.swing.JPanel calPan;
    private javax.swing.JPanel jPanel2;
    private javax.swing.JSplitPane jSplitPane1;
    private javax.swing.JPanel schedulingPan;
    private wf.ui.cmps.WFToolbar schedulingTitle;
    // End of variables declaration//GEN-END:variables

    @Override
    public void setPage(Page page) {
        PageDSL.fillByRole(page, calPan, CALENDAR_ROLE);
        PageDSL.fillByRole(page, schedulingPan, SELECTED_SCHEDULING_ROLE);
        schedulingTitle.populate(page.getParamsWithRole(SELECTED_SCHEDULING_ROLE).get(0));
        validate();
        repaint();
    }

    @Override
    public void onDispose() {
//        throw new UnsupportedOperationException("Not supported yet.");
    }
}
